package com.myway.dto.payment.domain;

import java.util.HashMap;

public enum PaymentLogTranType {
	PAY_INIT("PAY_INIT"), PAY_ACK("PAY_ACK"), VERIFY_INIT("VER_INIT"), VERIFY_ACK("VER_ACK"), VERIFY_BATCH("VER_BATCH"), 
	REFUND_INIT("REFUND_INIT"), REFUND_ACK("REFUND_ACK"),CHECK_INIT("CHECK_INIT"), CHECK_ACK("CHECK_ACK");

	private final String alias;
	private static HashMap<String, PaymentLogTranType> map;

	/**
	 * Construct the hash map at load time
	 */
	static {
		map = new HashMap<String, PaymentLogTranType>();
		for (PaymentLogTranType type : PaymentLogTranType.values()) {
			map.put(type.alias, type);
		}
	}

	PaymentLogTranType(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	/**
	 * Return a <code>PaymentLogTranType</code> object holding the value of specified alias name
	 * @param alias the alias name of the type
	 * @return a <code>PaymentLogTranType</code> object holding the value represented by the alias name argument
	 */
	public static PaymentLogTranType valueOfAlias(String alias) {
		PaymentLogTranType type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException("Unknown payment log tran type alias [" + alias + "]");
		}

		return type;
	}

}